import DateUtils from '../../node_modules/iview/src/utils/date'

export default {

    getSimpleStr(time) {
        return this.getStr(time, 'yyyy-MM-dd HH:mm:ss')
    },

    getStr(time, format) {
        if (typeof time === 'string') {
            time = Number(time)
        }

        if (typeof time === 'number') {
            time = new Date(time)
        }

        if (typeof time === 'object') {
            return DateUtils.format(time, format)
        }
    },
    convertStr(time1, origin_format, dest_format) {
        let date = DateUtils.parse(time1, origin_format);
        return DateUtils.format(date, dest_format)
    }

}
